<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        //基本数据类型：string number boolean null undefined symbol

        let s1 = Symbol('hello'); //独一无二

        let s2 = Symbol('hello');
        
        console.log(s1 === s2)
        console.log(typeof s1) 

        const shapeType = {
            triangle: Symbol('triangle')
        };

        
        //获取面积
        function getArea(shape, options) {
            let area = 0;

            switch (shape) {
                case 'Triangle': // 魔术字符串
                area = .5 * options.width * options.height;
                break;
                /* ... more code ... */
            }

            return area;
        }

        getArea(shapeType.triangle, { width: 100, height: 100 }); // 魔术字符串
        getArea(shapeType.triangle, { width: 100, height: 100 }); // 魔术字符串
        getArea(shapeType.triangle, { width: 100, height: 100 }); // 魔术字符串
        getArea(shapeType.triangle, { width: 100, height: 100 }); // 魔术字符串
    </script>
</body>
</html>